package com.frame.api;

import com.alibaba.fastjson.JSONObject;
import com.frame.config.WebSocketServer;
import com.frame.service.SrcProcessService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.IOException;
import java.util.HashMap;

@Slf4j
public class TestApi {

    @Autowired
    SrcProcessService srcProcessService;

    @XxlJob("dap")
    public String send() throws IOException {
        HashMap<String, Object> map = new HashMap<>();
        map.put("server",srcProcessService.getlist3());
        map.put("pie",srcProcessService.getlist3());
        JSONObject jsonObject = new JSONObject(map);
        WebSocketServer.sendAllMessage(jsonObject.toString());

        return jsonObject.toString();
    }
}
